﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using BOSS.Domain.Security;

namespace BOSS.Dao.Security
{
    /// <summary>
    /// 角色权限设置 DAO
    /// </summary>
    public interface IRolePrivilegeSettingDao : IEntityDao<RolePrivilegeSetting, int>
    {
        /// <summary>
        /// 查询指定角色的所有权限
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        PrivilegeGroup SelectByRole(Role role);

        /// <summary>
        /// 查询指定权限的所有设置
        /// </summary>
        /// <param name="privilegeName"></param>
        /// <returns></returns>
        IList<RolePrivilegeSetting> SelectByName(string privilegeName);

        /// <summary>
        /// 为指定角色添加权限
        /// </summary>
        /// <param name="role"></param>
        /// <param name="privilege"></param>
        /// <returns></returns>
        int Insert(Role role, Privilege privilege);

        /// <summary>
        /// 为指定角色更新权限
        /// </summary>
        /// <param name="role"></param>
        /// <param name="privilege"></param>
        void Update(Role role, Privilege privilege);

        /// <summary>
        /// 为指定角色移除权限
        /// </summary>
        /// <param name="role"></param>
        /// <param name="privilege"></param>
        void Delete(Role role, Privilege privilege);
    }
}
